import arbori.*;
import functii.*;
import operatori.*;

public class Main
{
	
	public static void main(String args[])
	{
		
		//exemplu cu Plus: f(x)=x+3.0
		Nod n=new Necunoscuta();
		Nod c=new Constanta(3);		
		Nod plus=new Plus();
		
		plus.setFStang(n);
		plus.setFDrept(c);
		
		ArboreFunctional a=new ArboreFunctional(plus);
		
		System.out.println("Functia este: f(x)="+a);
		System.out.println("Derivata este: f'(x)="+a.derivata());
		System.out.println("f(5)="+a.calculezValoare(5));
		System.out.println("f'(2)="+a.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu Produs: f(x)=(x+3.0)*(x-5)
		Nod n2=new Necunoscuta();
		Nod c2=new Constanta(3);	
		Nod plus2=new Plus();
		plus2.setFStang(n2);
		plus2.setFDrept(c2);
		
		Nod n3=new Necunoscuta();
		Nod c3=new Constanta(5);	
		Nod minus=new Minus();
		minus.setFStang(n3);
		minus.setFDrept(c3);
		
		Nod produs=new Produs();		
		produs.setFStang(plus2);
		produs.setFDrept(minus);
		
		ArboreFunctional a2=new ArboreFunctional(produs);
		
		System.out.println("Functia este: f(x)="+a2);
		System.out.println("Derivata este: f'(x)="+a2.derivata());
		System.out.println("f(5)="+a2.calculezValoare(5));
		System.out.println("f'(2)="+a2.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu Produs: f(x)=5*x
		Nod n4=new Necunoscuta();
		Nod c4=new Constanta(5);
		
		Nod produs2=new Produs();
		produs2.setFStang(c4);
		produs2.setFDrept(n4);
		
		ArboreFunctional a3=new ArboreFunctional(produs2);
		
		System.out.println("Functia este: f(x)="+a3);
		System.out.println("Derivata este: f'(x)="+a3.derivata());
		System.out.println("f(5)="+a3.calculezValoare(5));
		System.out.println("f'(2)="+a3.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu Cat: f(x)=(3+x)/2
		Nod c5=new Constanta(3);
		Nod n5=new Necunoscuta();
		Nod plus3=new Plus();
		plus3.setFStang(c5);
		plus3.setFDrept(n5);
		Nod c6=new Constanta(2);
		Nod cat=new Cat();
		cat.setFStang(plus3);
		cat.setFDrept(c6);
		
		ArboreFunctional a4=new ArboreFunctional(cat);
		
		System.out.println("Functia este: f(x)="+a4);
		System.out.println("Derivata este: f'(x)="+a4.derivata());
		System.out.println("f(5)="+a4.calculezValoare(5));
		System.out.println("f'(2)="+a4.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu Sin: f(x)=sin(x+1)
		Nod n7=new Necunoscuta();
		Nod c7=new Constanta(1);
		Nod plus4=new Plus();
		plus4.setFStang(n7);
		plus4.setFDrept(c7);
		Nod sin=new Sin();
		sin.setFStang(plus4);
		
		ArboreFunctional a5=new ArboreFunctional(sin);
		
		System.out.println("Functia este: f(x)="+a5);
		System.out.println("Derivata este: f'(x)="+a5.derivata());
		System.out.println("f(5)="+a5.calculezValoare(5));
		System.out.println("f'(2)="+a5.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu Cos: f(x)=cos(x)
		Nod n8=new Necunoscuta();
		Nod cos=new Cos();
		cos.setFStang(n8);
		
		ArboreFunctional a6=new ArboreFunctional(cos);
		
		System.out.println("Functia este: f(x)="+a6);
		System.out.println("Derivata este: f'(x)="+a6.derivata());
		System.out.println("f(5)="+a6.calculezValoare(5));
		System.out.println("f'(2)="+a6.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu Tangenta: f(x)=tg(x)
		Nod n9=new Necunoscuta();
		Nod tan=new Tangenta();
		tan.setFStang(n9);
		
		ArboreFunctional a7=new ArboreFunctional(tan);
		
		System.out.println("Functia este: f(x)="+a7);
		System.out.println("Derivata este: f'(x)="+a7.derivata());
		System.out.println("f(5)="+a7.calculezValoare(5));
		System.out.println("f'(2)="+a7.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu Cotangenta: f(x)=ctg(x)
		Nod n10=new Necunoscuta();
		Nod ctan=new Ctg();
		ctan.setFStang(n10);
		
		ArboreFunctional a8=new ArboreFunctional(ctan);
		
		System.out.println("Functia este: f(x)="+a8);
		System.out.println("Derivata este: f'(x)="+a8.derivata());
		System.out.println("f(5)="+a8.calculezValoare(5));
		System.out.println("f'(2)="+a8.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu arccos: f(x)=arccos(x)
		Nod n11=new Necunoscuta();
		Nod arccos=new Arccos();
		arccos.setFStang(n11);
		
		ArboreFunctional a9=new ArboreFunctional(arccos);
		
		System.out.println("Functia este: f(x)="+a9);
		System.out.println("Derivata este: f'(x)="+a9.derivata());
		System.out.println("f(5)="+a9.calculezValoare(5));
		System.out.println("f'(2)="+a9.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu arcctg: f(x)=arcctg(x)
		Nod n12=new Necunoscuta();
		Nod arcctg=new Arcctg();
		arcctg.setFStang(n12);
		
		ArboreFunctional a10=new ArboreFunctional(arcctg);
		
		System.out.println("Functia este: f(x)="+a10);
		System.out.println("Derivata este: f'(x)="+a10.derivata());
		System.out.println("f(5)="+a10.calculezValoare(5));
		System.out.println("f'(2)="+a10.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu arcsin: f(x)=arcsin(x)
		Nod n13=new Necunoscuta();
		Nod arcsin=new Arcsin();
		arcsin.setFStang(n13);
		
		ArboreFunctional a11=new ArboreFunctional(arcsin);
		
		System.out.println("Functia este: f(x)="+a11);
		System.out.println("Derivata este: f'(x)="+a11.derivata());
		System.out.println("f(5)="+a11.calculezValoare(5));
		System.out.println("f'(2)="+a11.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu arctg: f(x)=arctg(x)
		Nod n14=new Necunoscuta();
		Nod arctg=new Arctg();
		arctg.setFStang(n14);
		
		ArboreFunctional a12=new ArboreFunctional(arctg);
		
		System.out.println("Functia este: f(x)="+a12);
		System.out.println("Derivata este: f'(x)="+a12.derivata());
		System.out.println("f(5)="+a12.calculezValoare(5));
		System.out.println("f'(2)="+a12.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu exponentiala: f(x)=exp(x)
		Nod n15=new Necunoscuta();
		Nod exp=new Exp();
		exp.setFStang(n15);
		
		ArboreFunctional a13=new ArboreFunctional(exp);
		
		System.out.println("Functia este: f(x)="+a13);
		System.out.println("Derivata este: f'(x)="+a13.derivata());
		System.out.println("f(5)="+a13.calculezValoare(5));
		System.out.println("f'(2)="+a13.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu logaritm: f(x)=log(x)
		Nod n16=new Necunoscuta();
		Nod log=new Log();
		log.setFStang(n16);
		
		ArboreFunctional a14=new ArboreFunctional(log);
		
		System.out.println("Functia este: f(x)="+a14);
		System.out.println("Derivata este: f'(x)="+a14.derivata());
		System.out.println("f(5)="+a14.calculezValoare(5));
		System.out.println("f'(2)="+a14.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu putere: f(x)=pow(x)
		Nod n17=new Necunoscuta();
		Nod pow=new Putere();
		pow.setFStang(n17);
		
		ArboreFunctional a15=new ArboreFunctional(pow);
		
		System.out.println("Functia este: f(x)="+a15);
		System.out.println("Derivata este: f'(x)="+a15.derivata());
		System.out.println("f(5)="+a15.calculezValoare(5));
		System.out.println("f'(2)="+a15.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu radical: f(x)=sqrt(x)
		Nod n18=new Necunoscuta();
		Nod sqrt=new Radical();
		sqrt.setFStang(n18);
		
		ArboreFunctional a16=new ArboreFunctional(sqrt);
		
		System.out.println("Functia este: f(x)="+a16);
		System.out.println("Derivata este: f'(x)="+a16.derivata());
		System.out.println("f(5)="+a16.calculezValoare(5));
		System.out.println("f'(2)="+a16.calculezDerivata(2));
		System.out.println();
		
		//exemplu cu cosH: //f(x)=cosH(x)
		Nod n19=new Necunoscuta();
		Nod star=new CosH();
		star.setFStang(n19);
		
		ArboreFunctional a17=new ArboreFunctional(star);
		
		System.out.println("Functia este: f(x)="+a17);
		System.out.println("Derivata este: f'(x)="+a17.derivata());
		System.out.println("f(5)="+a17.calculezValoare(5));
		System.out.println("f'(2)="+a17.calculezDerivata(2));
		System.out.println();
		
		
		//exemplu cu steluta: f(x)=x**y
		Nod ns=new Necunoscuta();
		Nod cs=new Constanta(3);		
		Nod stea=new Steluta_Steluta();
		
		stea.setFStang(ns);
		stea.setFDrept(cs);
		
		ArboreFunctional a21=new ArboreFunctional(stea);
		
		System.out.println("Functia este: f(x)="+a21);
		System.out.println("Derivata este: f'(x)="+a21.derivata());
		System.out.println("f(5)="+a21.calculezValoare(5));
		System.out.println("f'(2)="+a21.calculezDerivata(2));
		System.out.println();
		
		
		////////f(x)=sqrt(x)**cosh(x)+x^2//////////
		Nod n20=new Necunoscuta();
		Nod m=new CosH();
		m.setFStang(n20);
		
		Nod n21 = new Necunoscuta();
		Nod sq=new Radical();
		sq.setFStang(n21);
		
		Nod n22 = new Necunoscuta();
		Nod power=new Putere();
		power.setFStang(n22);
		
		ArboreFunctional a18=new ArboreFunctional(m);
		ArboreFunctional a19=new ArboreFunctional(sq);
		ArboreFunctional a20=new ArboreFunctional(power);
		
		
		System.out.println("Functia este: f(x)="+a18+"+"+a19+"+"+a20);
		//System.out.println("Derivata este: f'(x)="+a18.derivata());
		System.out.println("f(5)="+a18.calculezValoare(5)+a19.calculezValoare(5)+a20.calculezValoare(5));
		//System.out.println("f'(2)="+a18.calculezDerivata(2));
		System.out.println();
		

		
	}

}

